//
//  YZLTableViewCell.m
//  Car
//
//  Created by dllo on 15/10/28.
//  Copyright © 2015年 岳明. All rights reserved.
//

#import "YZLTableViewCell.h"
#import "UIImageView+WebCache.h"

@interface YZLTableViewCell ()

@property (nonatomic, strong) UILabel *leftLabel;
@property (nonatomic, strong) UIImageView *leftImage;

@end

@implementation YZLTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.leftImage = [[UIImageView alloc] init];
//        self.leftImage.backgroundColor = [UIColor yellowColor];
        [self.contentView addSubview:self.leftImage];
        
        self.leftLabel = [[UILabel alloc] init];
//        self.leftLabel.backgroundColor = [UIColor blackColor];
        [self.contentView addSubview:self.leftLabel];
    }
    return self;
}

- (void)layoutSubviews {
    
    [super layoutSubviews];
    self.leftImage.frame = CGRectMake(10, 7, 40, 30);
    self.leftLabel.frame = CGRectMake(65, 7, 150, 30);
    
}

- (void)setModel:(YZLCarBrandModel *)model {
    if (_model != model) {
        _model = model;
    }
    NSDictionary *dic = [self.model.brands objectAtIndex:self.num];
    self.leftLabel.text = [dic objectForKey:@"name"];
    NSURL *url = [NSURL URLWithString:[dic objectForKey:@"icon"]];
    [self.leftImage sd_setImageWithURL:url];
}


/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
